import React, { useState } from 'react'
import Child from './Child'

export default function MemoDemo() {
  const [count, setCount] = useState(0)
  const [title, setTitle] = useState('hello')

  return (
    <>
      <h1>{count} {title}</h1>
      <button onClick={() => {setCount(count => count + 1)}}>add</button>
      <button onClick={() => {setTitle(title => 'world')}}>change</button>
      <Child count={count}></Child>
    </>
  )
}
